import React, { useState } from "react";
import { Button,DotLoading } from "antd-mobile";

import img from './1.jpeg';

export const  HOC1=(Component:any)=>(props:any)=>{
  const [show,setShow] = useState<boolean>(false)
  return <div>
    <Button color="primary" onClick={()=>setShow(v=>!v)}>加载图片</Button>
    {show ? <Component {...props}/> : <div style={{margin:25}}><DotLoading color="primary"/>加载中</div>}
  </div>
}
 

export const Index1:React.FC<any> = ({})=> {
  return (
    <div>
      <img src={img} width={160} height={120} alt="" />
    </div>
  );
}
export default HOC1(Index1);
